﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="MemberDetail.aspx.vb" Inherits="FishTank.MemberDetail" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h1>Member profile</h1>
    <p>
        <asp:FormView ID="DetailFormView" runat="server" width="100%" CssClass="detailView">
            <EditItemTemplate>
                <div class="profileEdit">
                    Your username is
                    <asp:Label ID="UserNameLabel" runat="server" Text='<%# Bind("UserName") %>' />
                    <br />
                    First Name:<br />
                    <asp:TextBox ID="FirstNameTextBox" runat="server" 
                        Text='<%# Bind("FirstName") %>' Width="20%" />
                    <br />
                    Last Name:<br />
                    <asp:TextBox ID="LastNameTextBox" runat="server" Text='<%# Bind("LastName") %>' 
                        Width="20%" />
                    <br />
                    Upload Photo:<br />
                    <asp:FileUpload ID="PhotoFileUpload" runat="server" Width="50%" />
                    <asp:RegularExpressionValidator ID="FileExtValidator" runat="server"
                            ValidationExpression="(.*\.([gG][iI][fF]|[jJ][pP][gG]|[jJ][pP][eE][gG]|[pP][nN][gG])$)"  
                            ControlToValidate="PhotoFileUpload" ErrorMessage="Only jpg/gif/png photos are supported."
                            ValidationGroup="FishInfoValidationGroup" Display="None"></asp:RegularExpressionValidator>
                    <br />
                    Current Photo:<br />
                    <asp:Image ID="PersonImage" runat="server"
                        ImageUrl='<%# GetPhotoNormalPath(CStr(Eval("Photo"))) %>'
                        AlternateText="<%# Bind('UserName') %>"/>
                    <br />
                    <asp:Button ID="SaveButton" runat="server" Text="Save" 
                        onclick="SaveButton_Click" />
                    <asp:Button ID="CancelEditButton" runat="server" Text="Cancel" 
                        onclick="CancelEditButton_Click" />
                </div>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:Image ID="PersonImage" runat="server" CssClass="profileImage"
                               ImageUrl='<%# GetPhotoNormalPath(CStr(Eval("Photo"))) %>'
                               AlternateText="<%# Bind('UserName') %>" />
                <div class="profileView">
                    
                    <h2>
                        <asp:Label ID="FirstNameLabel" runat="server" Text='<%# Bind("FirstName") %>' />
                        <asp:Label ID="LastNameLabel" runat="server" Text='<%# Bind("LastName") %>' />
                    </h2>
                    <p>
                        username is
                        <asp:Label ID="UserNameLabel" runat="server" Text='<%# Bind("UserName") %>' />
                    </p>
                    <p>
                        premium member:
                        <asp:Label ID="PremiumMemberLabel" runat="server" Text="Yes" Visible='<%# IsPremiumMember() %>' />
                        <asp:Label ID="NotPremiumMemberLabel" runat="server" Text="No" Visible='<%# Not IsPremiumMember() %>' />
                        
                        (Premium members are allowed to update the product and fish database)
                    </p>
                    <p>
                    <asp:Button ID="EditButton" runat="server" Text="Edit" Visible="<%# ModificationPermitted() %>"
                        onclick="EditButton_Click" />
                    </p>

                    <h2>Member's content</h2>
                    <ul>
                        <li><a href="/Pages/AquariumList.aspx?UserName=<%# Eval("UserName") %>">Aquariums</a></li>
                        <li><a href="/Pages/QuestionList.aspx?UserName=<%# Eval("UserName") %>">Questions</a></li>
                        <li><a href="/Pages/PhotoList.aspx?UserName=<%# Eval("UserName") %>">Photos</a></li>
                    </ul>
                    </div>
            </ItemTemplate>
            
        </asp:FormView>
    </p>
</asp:Content>
